export function trimExt(fname) {
  return fname.replace(/\.[^/.]+$/, '')
}

// Ext returns the file name extension used by path.
// The extension is the suffix beginning at the final dot
// in the final element of path; it is empty if there is
// no dot.
export function ext(path) {
  for (let i = path.length - 1; i >= 0 && path[i] !== '/'; i--) {
    if (path[i] === '.') {
      return path.substring(i)
    }
  }

  return ''
}
